package user_test

import (
	"context"
	"testing"

	"gitlab.com/go-course-project/go17/vblog/apps/user"
)

var (
	ctx = context.Background()
)

// 我要测试的对象是什么?, 这个服务的具体实现
// Service的具体实现？现在还没实现
// $2a$10$yHVSVuyIpTrQxwiuZUwSMuaJFsnd4YBd6hgA.31xNzuyTu4voD/QW
// $2a$10$fe0lsMhM15i4cjHmWudroOOIIBR27Nb7vwrigwK.9PhWdFld44Yze
// $2a$10$RoR0qK37vfc7pddPV0mpU.nN15Lv8745A40MkCJLe47Q00Ag83Qru
// https://gitee.com/infraboard/go-course/blob/master/day09/go-hash.md#bcrypt
func TestRegistry(t *testing.T) {
	req := user.NewRegistryRequest()
	req.Username = "test02"
	req.Password = "123456"
	ins, err := user.GetService().Registry(ctx, req)
	if err != nil {
		t.Fatal(err)
	}
	t.Log(ins)
}

func TestDescribeUser(t *testing.T) {
	ins, err := user.GetService().DescribeUser(ctx, &user.DescribeUserRequest{
		user.DESCRIBE_BY_USERNAME, "admin",
	})
	if err != nil {
		t.Fatal(err)
	}
	//
	// if ins.Password = in.Password
	t.Log(ins)
}
